package com.kungfuhacking.wristbandpro.my.activity;

import android.os.Bundle;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.kungfuhacking.wristbandpro.R;
import com.kungfuhacking.wristbandpro.base.view.BaseActivity;
import com.kungfuhacking.wristbandpro.custom.TitleBarView;
import com.kungfuhacking.wristbandpro.net.ApiService;

/**
 * 关于我们
 * Created by Aaron on 17/4/17.
 */

public class AboutUsActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_webview);
        initWidget();

    }

    private void initWidget() {
        WebView wv_about = (WebView) findViewById(R.id.wv);
        TitleBarView tbv = (TitleBarView) findViewById(R.id.tbv);

        tbv.setOnLeftClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        tbv.setTitle(getResources().getString(R.string.about_us));

        MyWebViewClient client = new MyWebViewClient();

        WebSettings settings = wv_about.getSettings();

        settings.setDomStorageEnabled(true);
        settings.setJavaScriptEnabled(true);
        wv_about.setWebViewClient(client);
        wv_about.loadUrl(ApiService.INDEX_HOST);
    }

    private class MyWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return true;
        }
    }
}
